home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / ColorLab / Source / ColorLabApp.m < prev    next >
Text File  |  1994-04-01  |  1KB  |  46 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "ColorLabApp.h"
  5. #import <objc/objc.h>        /* for BOOL values YES, NO */
  6. #import <appkit/color.h>
  7. #import <appkit/NXColorWell.h>
  8. #import <appkit/Matrix.h>
  9.  
  10. @implementation ColorLabApp
  11.  
  12. - appDidInit:sender
  13. {
  14.     [myColorWell setContinuous:YES];    /* not needed */
  15.     [myColorWell activate:(int)YES];    /* activate */
  16.     [self orderFrontColorPanel:self];
  17.     return self;
  18. }
  19.  
  20.  
  21. // Action methond for the ColorWell
  22. - showColorInNumbers:sender
  23. {
  24. int i;
  25. NXColor color;
  26. float cmpnts[5];
  27.  
  28.     color =[sender color];
  29.     // update the HSBA number display
  30.     NXConvertColorToHSBA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3]);
  31.     for(i=0; i<4; i++)
  32.     [[hsbaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];
  33.     // doit for RGBA representation
  34.     NXConvertColorToRGBA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3]);
  35.     for(i=0; i<4; i++)
  36.     [[rgbaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];
  37.     // doit for CMYKA representation
  38.     NXConvertColorToCMYKA(color, &cmpnts[0], &cmpnts[1], &cmpnts[2], &cmpnts[3], &cmpnts[4]);
  39.     for(i=0; i<5; i++)
  40.     [[cmykaMatrix findCellWithTag:i] setFloatValue: cmpnts[i]];
  41.  
  42.     return self;
  43. }
  44.  
  45. @end
  46.